#ifndef SEGMENT_H
#define SEGMENT_H

#include "point.h"
#include "envelope.h"
#include "line.h"

class Segment;
//enum InterSectionKindEnum;
//struct Intersection;

class Segment
{
public:
    enum InterSectionKindEnum
    {
        kPoint,
        kNull,
        kSegment
    };
    struct Intersection
    {
        InterSectionKindEnum kind;
        Point result[2];
    };
public:
    Segment();
public:
    inline Point org() const
    {
        return org_;
    }
    inline Point dst() const
    {
        return dst_;
    }
    inline void set_org(const Point& p)
    {
        org_.CopyFrom(p);
    }
    inline void set_dst(const Point& p)
    {
        dst_.CopyFrom(p);
    }
public:
    Envelope GetEnvelope() const;
    Line GetLine() const;
public:
    Point::PointSiteEnum PointSite(const Point &p) const;
    static bool IsIntersect(const Segment &s1,const Segment &s2);
    Intersection IntersectPoint(const Segment &other) const;
private:
    Point org_;
    Point dst_;
};


#endif // SEGMENT_H
